from core.base.page_base import BasePage
from selenium.webdriver.common.by import By
from tools.file_read import get_page_locators


class LoginPage(BasePage):
    # 从YAML加载定位器
    locators = get_page_locators("data/login_case.yaml", "login")

    def do_login(self, username, password):
        """业务方法：执行登录操作"""
        self.username_input = username
        self.password_input = password
        self.login_btn.click()

    def get_error_msg(self):
        """业务方法：获取错误提示文本"""
        return self.error_msg.text